home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / selfile.zip / SELFILE.DOC < prev    next >
Text File  |  1993-01-04  |  8KB  |  191 lines

  1. Selfile.Pas - Copyright (c) 1988 - Repstad Computer Consultants
  2.                                    RFD #1, Box 3720
  3.                                    Sheldon, VT 05483
  4.                                    (802) 933-5133 (voice)
  5.                                    (802) 933-2417 (Data - The Black Creek BBS)
  6.  
  7.  
  8. Selfile is a Turbo Pascal V4.0 Unit that you can include in programs you
  9. write. It is shareware...this means that if you use it you are expected
  10. to make a contribution, $10.00 is requested. Those who use it and do
  11. not make a contribution will suffer the consequences in the next dimension.
  12.  
  13. To use selfile in your program include the clause:
  14.  
  15.     "Uses SelFile;"
  16.  
  17. in your program, selfile should be declared before any "Uses" references
  18. to DOS or CRT, (i.e. USES SelFile,Dos,Crt;);
  19.  
  20. There are two basic functions defined in the selfile TPU. The first is
  21. Sel_File itself. It will open a window and display the contents of the 
  22. file directory specified by PATH within that window. The user can then
  23. use the arrow keys and PgUp/PgDn keys to highlight the desired file. 
  24.  
  25. Added in version 3.0: Selfile now allows the user to select a file by 
  26. typing characters. Characters entered by the user define a search string
  27. that the program uses to match against the filenames. The first file
  28. in the list that matches the search string will be highlighted. This
  29. means that the user can jump to a file of his/her choice by typing
  30. the letters that begin the filename. In order to facilitate this 
  31. method of file selection Selfile now uses in insertion sort to build the
  32. files linked list in alphabetical order. The search string the user
  33. enters is displayed in the lower left corner of the window so he/she
  34. will be able to see what they have typed. Selfile will not automatically
  35. select a file this way, only highlight it, the user still has to 
  36. hit the return key to select the file. 
  37.  
  38. Hitting the return key selects the file, hitting the escape key aborts the 
  39. file selection. Selfile returns an integer code indicating the action the
  40. user took, return codes are;
  41.  
  42.          -1   =    No files found that match the search path.
  43.  
  44.          0    =    User hit the escape key to abort file selection.
  45.  
  46.          1    =    User selected a file from the list, filename returned
  47.                    in the argument File_Name.
  48.          
  49.          2    =    User hit the F1 Key inidcating he wants to create a 
  50.                    New File (This is my convention, you can change this
  51.                    if you like, you can also add more Function key
  52.                    definitions and return codes).
  53.  
  54. Example:
  55.  
  56. Const
  57.  
  58.     Title = 'Select A File';
  59.  
  60. Var
  61.  
  62.     File_Name  :  String[12];
  63.     Path       :  String[3] = '*.*;
  64.     Attr       :  Integer = 0;
  65.  
  66. Begin
  67.  
  68.     IRetVal := Sel_File(File_Name,Title,Path,Attr);
  69.     If (IRetVal = 1) Then
  70.  
  71.               { here we have a file name returned}
  72.  
  73.     Else if (IRetVal = 2) Then
  74.  
  75.               { here user hit the F1 key indicating he wants to create
  76.                 a new file}
  77.  
  78.     Else if (IRetVal = -1) Then
  79.  
  80.               { no files found }
  81.  
  82.     Else {IRetVal = 0}
  83.  
  84.               { here no file name was returned/selected, user hit esc key}
  85.  
  86. End.
  87. Arguments to the Sel_File function are as follows:
  88.  
  89.     File_Name : This should be a string declared as String[12], you must
  90.                 also include the compiler directive {$V-} to turn off 
  91.                 strict string argument checking .
  92.  
  93.     Title :   This is a string to displayed in the upper left corner
  94.               of the boarder of the file display window.
  95.               (e.g. Title := 'Select A File';)
  96.               The length of the title string must be less than 
  97.               the file selection window with. See description for
  98.               the procedure SetLim for more info on window widths.
  99.  
  100.     Path  :   This is the dos path/file specifier used to search with.
  101.               (e.g. Path := 'C:\Data\*.Dat';)
  102.               
  103.     Attr  :   This is the attribute of the files you wish to search
  104.               for, normally 0, see the TPC 4.0 manual reference for
  105.               the FindFirst function for more info.
  106.               (e.g. Attr := 0;)
  107.  
  108. Procedure SetLim allows you to define the position and size of the file
  109. selection window. The arguments to SetLim are as follows:
  110.  
  111.     RowB  :   Screen absolute row to begin the window at.
  112.     ColB  :   Screen absolute col to begin the window at.
  113.     RowQ  :   Number of rows of file names to display (if you
  114.               select a boarder then the actual number of rows of
  115.               file names will be 2 less).
  116.     ColQ  :   Number of Columns of file names can be in the 
  117.               range 1 to 5.
  118.               NOT the number of screen columns in the window.
  119.     Active:   Video attribute for the highlighted filename.
  120.     Inactive: Video attribute for the window and non-highlighted filenames.
  121.     boarder:  Boarder type 1 = double line, 2 = single line, 3 = +- chars,
  122.               0 = no boarder.
  123.  
  124. The file Test.Pas shows the use of Sel_File and SetLim. Play around with it
  125. to see what really happens. Also since the source code is included here
  126. you can see for yourself what is going on. 
  127.  
  128. As with any program there may be bugs, etc. if you find a bug please report it,
  129. preferably on my BBS, or on the CIS BPROGA forum. Also report any errors in
  130. the documentation...etc...
  131.  
  132. If you have any suggestions let me know.
  133.  
  134. Even if you don't want to contribute, and you want to use it, please 
  135. register, I'd like to get an idea of how many people are using the thing and
  136. wether or not I should spend more time on it and other modules.
  137.  
  138.  
  139. And now a message from our sponsors:
  140.  
  141.     +-----------------------------------------------------------+
  142.     |                                                           |
  143.     |                    The Black Creek BBS                    |
  144.     |                                                           |
  145.     |                     (802) 933-2417                        |
  146.     |                                                           |
  147.     | 300/1200/2400 Baud                    24hrs/7days a week  |
  148.     |                                                           |
  149.     |                     40Megs On-Line                        |
  150.     |                                                           |
  151.     | Home of PC-Gammon - The best backgammon game around!      |
  152.     |                                                           |
  153.     | Call Today... We're waiting to hear from you...           |
  154.     |                                                           |
  155.     +-----------------------------------------------------------+
  156.                     
  157.  
  158.  
  159.  
  160.                        Sel_File Registration Form
  161.  
  162.  
  163. Name:
  164.          --------------------------------------------------
  165.  
  166. Address:
  167.          --------------------------------------------------
  168.  
  169. City:    
  170.          --------------------------------------------------
  171.  
  172. State:             Zip:
  173.          -------        --------------------
  174.  
  175. Phone:   
  176.          --------------------------------------------------
  177.  
  178. Donation:
  179.          ---------------------------------------------------
  180.  
  181. Thank you for your registration and (hopefully) your donation.
  182. You will be contacted with information of future releases products.
  183.  
  184.  
  185. Mail this form to:
  186.  
  187.                    Repstad Computer Consultants
  188.                    RFD #1, Box 3720
  189.                    Sheldon, VT 05483
  190.          
  191.